﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;

namespace AjaxSnippets.WebApplicationExample
{
    /// <summary>
    /// Summary description for RelayFieldsSnippetService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    [ScriptService]
    public class RelayFieldsSnippetService : System.Web.Services.WebService
    {
        [WebMethod]
        public string GetRelayFieldsSnippet()
        {
            return Snippet.Create<RelayFieldsSnippet>("snippet", "~/RelayFields/Snippet.ascx").ToString();
        }

        [WebMethod]
        public string RelayFields(string name, string color, string gender, string[] interests, string[] food, bool lovesCSharp, string slide)
        {
            return string.Format("Name:{0}\nColor:{1}\nGender:{2}\nInterests:{3}\nFood:{4}\nLoves C#:{5}\nSlide:{6}", name, color, gender, interests == null ? "none" : String.Join(",", interests), food == null ? "none" : String.Join(",", food), lovesCSharp, slide);
        }
    }
}
